<?php
namespace frontend\controllers;
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

use Yii;
use yii\web\Controller;
use common\help\uploadfile;

class FileController extends Controller {
    
    public $enableCsrfValidation=false;
    
    public function actionTest()
    {
        return $this->render('file');
    }
    
    public function actionUpload()
    {
        $file = $_FILES;
        $aa = Yii::$app->request->post('aa');
        var_dump($file);
        die;
        $save_path = "uploads/img/".date('Y-m-d');
        $file_name = mt_rand();
        $config = array(
                'savePath' => $save_path,
                'fileName' => $file_name
        );
        $obj = new uploadfile($config);
        $url = $obj->upload($file,$save_path,$file_name);
        
        if(!empty($url))
        {
             echo $url;die;
        }else{
            echo "shibai";
        }
       
    }
    
}